<!-- Dom模板 -->
<template>
  <div>
    <!-- Dom内容 -->
    <!-- "state":1, // 1待处理  2已处理  -->
    <div class="top">
      <p>商品筛选</p>
      <div>
        <span class="name">姓名</span
        ><input
          ref="input"
          type="text"
          placeholder="请输入学员账号、昵称、手机号"
        /><span class="xuan"
          ><i class="iconfont icon-wulianwangpingtaiicon-31-copy"></i>筛选</span
        >
      </div>
    </div>
    <div class="title">
      <span>商品列表</span>
      <button @click="addshopping()">添加商品</button>
    </div>
    <el-table
      ref="multipleTable"
      :data="dataList"
      tooltip-effect="dark"
      style="width: 100%"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="index" width="50">
        <template slot-scope="scope">
          <input type="checkbox" v-model="scope.row.checked" />
        </template>
      </el-table-column>
      <el-table-column prop="order" label="商品ID" width="120">
      </el-table-column>
      <el-table-column prop="name" label="商品名称" width="120">
      </el-table-column>
      <el-table-column prop="username" label="商品图片" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="password" label="商品运费" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="number" label="商品价格" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="oldTime" label="商品总销量" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="userClose" label="商品库存" show-overflow-tooltip
        >111
        <template slot-scope="scope">
          <el-switch
            @change="handelChange(scope.row)"
            :value="scope.row.state"
            :active-value="1"
            :inactive-value="2"
          >
          </el-switch>
        </template>
      </el-table-column>
      <el-table-column prop="operation" label="操作" show-overflow-tooltip>
        <template slot-scope="scope">
          <div class="operation">
            <span @click="editor(scope.row)">编辑</span>
            <span @click="del(scope.row)">删除</span>
          </div>
        </template>
      </el-table-column>
    </el-table>

    <div class="last">
      <div class="last_left">
        <input type="checkbox" v-model="checkAll" />全选
      </div>
      <div class="last_right">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400"
        >
        </el-pagination>
      </div>
    </div>

    <div class="alert" v-if="alertFlag">
      <div class="alert_box">
        <el-form
          :label-position="labelPosition"
          label-width="80px"
          :model="formLabelAlign"
        >
          <el-form-item label="用户昵称">
            <el-input v-model="formLabelAlign.name"></el-input>
          </el-form-item>
          <el-form-item label="手机号">
            <el-input v-model="formLabelAlign.username"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input v-model="formLabelAlign.password"></el-input>
          </el-form-item>
        </el-form>

        <div class="btn">
          <button class="yes">确定</button>
          <button class="quxiao1">取消</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import a from './a'; // 引入组件
import * as API from "@/api/index.js";
export default {
  name: "",
  components: {},
  data() {
    return {
      // 弹框里面的
      labelPosition: "right",
      formLabelAlign: {
        name: "",
        username: "",
        password: "",
      },

      msg: "测试",
      dataAlert: null,
      dataList: [],
      obj3: {},
      multipleSelection: [],
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      alertFlag: false,
      obj: { numTiao: "2", nowPage: "1" },
      num: 0,
      pageData: [],
      value: "",
    };
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {},
  computed: {
    checkAll: {
      get() {
        return this.pageData.every((item) => {
          return item.checked;
        });
      },
      set(val) {
        this.pageData.forEach((item) => {
          item.checked = val;
        });
      },
    },
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {},
  // Vue方法定义
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    addshopping(){
      this.$router.push('/addStudents')
    }
  },
};
</script>
<style scoped>
/* @import url(''); 引入css类 */
/* @import url('../../../../../iconfont/font_2151974_4mkn85tmrd7/iconfont.css'); */
.box_min {
  margin-bottom: 10px;
}
.box_min span {
  width: 120px;
  display: inline-block;
  text-align: right;
  box-sizing: border-box;
  padding-right: 10px;
}
.box_min input {
  width: 50%;
  border-radius: 4px;
  background-image: none;
  border: 1px solid #dcdfe6;
  box-sizing: border-box;
  color: #606266;
  display: inline-block;
  height: 40px;
  line-height: 40px;
  outline: 0;
  padding: 0 15px;
}
.alert_box > div {
  width: 100%;
  height: 50px;
  line-height: 50px;
  font-size: 20px;
  font-family: fangsong;
  font-weight: bold;
  margin: 21px auto;
}
.yes {
  width: 75px;
  height: 40px;
  font-size: 18px;
  border: none;
  outline: none;
  background: blue;
  color: white;
  float: left;
  margin-left: 45px;
  margin-top: 8px;
}
.quxiao1 {
  width: 75px;
  height: 40px;
  font-size: 18px;
  border: none;
  outline: none;
  background: #eee;
  color: black;
  float: right;
  margin-right: 45px;
  margin-top: 8px;
}
.last {
  width: 100%;
  height: 50px;
  background: white;
  line-height: 50px;
  box-sizing: border-box;
  padding: 0 10px;
}

.last .last_left {
  float: left;
}
.last .last_right {
  width: 40%;
  float: right;
  margin-top: 10px;
}

.top {
  width: 100%;
  height: 90px;
  background: white;
  margin-bottom: 15px;
}
.top p {
  height: 40px;
  line-height: 40px;
  margin-left: 20px;
  font-weight: 700;
}
.top div {
  height: 50px;
  line-height: 50px;
  margin-left: 20px;
  position: relative;
}
.top div .name {
  font-size: 14px;
  font-weight: 600;
  margin-right: 20px;
}
.top input {
  outline: none;
  border: 1px solid #ccc;
  width: 250px;
  height: 32px;
  box-sizing: border-box;
  padding-left: 10px;
}
.top .xuan {
  display: inline-block;
  width: 75px;
  height: 32px;
  margin-left: 25px;
  color: white;
  background: #38a189;
  position: absolute;
  top: 10px;
  left: 300px;
  line-height: 32px;
  text-align: center;
  box-sizing: border-box;
  padding-right: 8px;
}
.top i {
  font-size: 30px;
  vertical-align: middle;
}
.title {
  width: 100%;
  height: 60px;
  background: white;
  overflow: hidden;
  border-bottom: 1px solid #eee;
  line-height: 60px;
}
.title span {
  float: left;
  width: 100px;
  height: 60px;
  line-height: 60px;
  margin-left: 20px;
}
.title button {
  border: none;
  outline: none;
  width: 100px;
  height: 40px;
  line-height: 40px;
  float: right;
  margin-top: 10px;
  background: #38a189;
  color: white;
  border-radius: 4px;
  font-size: 16px;
}
.open {
  display: inline-block;
  width: 50px;
  height: 25px;
  background: #eee;
  border-radius: 20px;
}
.operation span:nth-child(1) {
  color: green;
  font-size: 13px;
  cursor: pointer;
}
.operation span:nth-child(2) {
  color: red;
  font-size: 13px;
  cursor: pointer;
}

.alert {
  z-index: 134;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}
.alert_box {
  width: 600px;
  height: 500px;
  background: white;
  margin-left: -300px;
  margin-top: -250px;
  position: absolute;
  top: 50%;
  left: 50%;
}
</style>